import request from '@/utils/request';

// 申请提现列表（用户/公众号）

export async function userWithdrawalList(params) {
  const res = await request.get('/massage/userWithdrawal/page', { params });
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 获取分销提现列表头部数据

export async function getUserHeaderDate(params) {
  const res = await request.get('/massage/userWithdrawal/getUserHeaderDate', {
    params
  });
  console.log(res);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

//   分销列表删除接口
export async function userWithdrawalDelete(id) {
  const res = await request.delete('/massage/userWithdrawal/' + id);
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}

//   分销列表批量删除
// export async function userWithdrawalBatch(params) {
//   const res = await request.delete('/massage/userWithdrawal/batch', { params });
//   console.log(res);
//   if (res.data.code === 200) {
//     return res.data.message;
//   }
//   return Promise.reject(new Error(res.data.message));
// }
export async function userWithdrawalBatch(data) {
  const res = await request.delete('/massage/userWithdrawal/batch', { data });
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.message));
}

// 佣金来源

export async function commissionSource(params) {
  const res = await request.get(
    '/massage/userWithdrawal/getCommissionRecords',
    { params }
  );
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 提现审核
export async function withdrawal(data) {
  const res = await request.post('/massage/userWithdrawal/withdrawal', data);
  console.log(res);
  if (res.data.code === 200) {
    return res.data.message;
  }
  return Promise.reject(new Error(res.data.data.message));
}
